<template>
  <div id="app">
    <!-- 顶部栏区域 -->
    <mt-header title="信息管理系统">
      <router-link to="/" slot="left">
        <mt-button icon="back">返回</mt-button>
      </router-link>
      <mt-button icon="more" slot="right"></mt-button>
    </mt-header>

    <!-- 路由组件出口 -->
    <router-view />

    <!-- 底部栏 -->
    <mt-tabbar v-model="selected">
      <mt-tab-item id="Home">
        <img slot="icon" src="../images/index.png" />
        首页
      </mt-tab-item>
      <mt-tab-item id="vip">
        <img slot="icon" src="../images/vip.png" />
        会员
      </mt-tab-item>
      <mt-tab-item id="shopingcar">
        <img slot="icon" src="../images/shoppingcar.png" />
        购物车
      </mt-tab-item>
      <mt-tab-item id="search">
        <img slot="icon" src="../images/search.png" /> 
        查找
      </mt-tab-item>
    </mt-tabbar>
  </div>
</template>

<script>
export default {
  name: "App",
  data() {
    return{
      selected:''
    }
  },
  watch:{
    selected:function(newV, oldV) {
      console.log(newV,oldV);
      // console.log(this.selected);    这个this.selected其实就是 newV
      this.$router.push({name:this.selected});   
    }
  }
};
</script>

<style>
* {
  padding: 0;
  margin: 0;
}
</style>
